/********************************************************
 * Filename: TclPerspective.java
 * Author: LMU
 * Program: TUnit
 * Description: Creates the tcl perspective for eclipse.  
 * Revision History:
 * 20060418: Initial Revision.
 * *****************************************************/

package edu.lmu.cs.tUnit.perspective;

import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;

import edu.lmu.cs.tUnit.log.TUnitLog;

public class TclPerspective implements IPerspectiveFactory {
	public void createInitialLayout(IPageLayout layout) {
		defineActions(layout);
		defineLayout(layout);
		TUnitLog.logInfo("TUnit Perspective opened.");
	}
	
	public void defineActions(IPageLayout layout) {
		// Add "new wizards".
		layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");
		layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");
		layout.addNewWizardShortcut("edu.lmu.cs.tUnit.wizard.tcl.package");
		layout.addNewWizardShortcut("edu.lmu.cs.tUnit.wizard.tcl.file");
		
		// Add "show views".
		layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
		layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
		layout.addShowViewShortcut(IPageLayout.ID_EDITOR_AREA);
		layout.addShowViewShortcut("org.eclipse.ui.console.ConsoleView");
		layout.addShowViewShortcut("edu.lmu.cs.tUnit.view.tcl");
	}
	
	public void defineLayout(IPageLayout layout) {
		 // Editors are placed for free.
		 String editorArea = layout.getEditorArea();

		// Place navigator to left of the editor area
		IFolderLayout left =
			layout.createFolder("left", IPageLayout.LEFT, 0.23f, editorArea);
		left.addView(IPageLayout.ID_RES_NAV);
		left.addView("edu.lmu.cs.tUnit.view.tcl");
		
		IFolderLayout bottom = 
			layout.createFolder("bottom", IPageLayout.BOTTOM, 0.75f, editorArea);
		bottom.addView(IPageLayout.ID_TASK_LIST);
		bottom.addView("org.eclipse.ui.console.ConsoleView");
		
		//IFolderLayout right = 
		//	layout.createFolder("right", IPageLayout.RIGHT, 0.73f, editorArea);
		//right.addView("edu.lmu.cs.tUnit.view.tcl");
	}
}
